
    let ul = document.querySelector(".caidanul")

    let xhr1 = new XMLHttpRequest()
    xhr1.open("get","http://chst.vip:1234/api/getindexmenu",true)
    xhr1.onload = function(){
        if(xhr1.status === 200){
            let caidan = JSON.parse(xhr1.responseText)
            console.log(caidan.result)
            let lis =''
            let regExp = /<img\s*src=\"([^\"]*?)\"[^>]*>/;
    
            caidan.result.forEach((item,index) => {
                let pic = caidan.result[index].img.match(regExp)[1];
                lis +=`
                <li class="caidandian">
                <a href="./pages/${item.titlehref}">
                <img src="http://chst.vip:8081/for-stu/wfzh/${pic}">
                    <p>${item.name}</p>
                </a>
            </li>
                `
            })
            ul.innerHTML = lis
        }
    }
    xhr1.send(null)





   



    // let xhr2 = new XMLHttpRequest()
    // xhr2.open("get","http://chst.vip:1234/api/getmoneyctrl")
    // xhr2.onload = function(){
    //     if(xhr2.status === 200){
    //         let res2 = JSON.parse(xhr2.responseText)
    //         // console.log(res2.result)
    //         let llis =''
    //         let regExp = /^<[^<]+\s+src="([^''""]*)"/;

    //         res2.result.forEach((itemt,indext)=>{
    //             let url = res2.result[indext].productImgSm.match(regExp)[1].split('=')[2];
    //             llis +=`
                
    //             <li productid=${itemt.productId}>
    //                         <img src=${url} alt="">
    //                         <div>
    //                             <h4>${itemt.productName}
    //                             <span>
    //                                 ${itemt.productPinkage}
    //                             </span>
    //                             </h4>

    //                             <span>${itemt.productFrom}
    //                             ${itemt.productTime}
    //                             </span>

    //                         <span>
    //                             <i>
    //                             <img src="./imges/pl.png" alt="">
    //                             </i>
    //                             ${itemt.productComCount}
    //                         </span>
                                
    //                         </div>
                            
    //                     </li>
                       
                
    //             `
    //         })
    //         ult.innerHTML = llis

    //     }
    // }
    // xhr2.send(null)



   




$('ul').on('click','li:nth-child(8)',function(){
    // alert(333)
    $(this).find('a').removeAttr('href')
    $(this).nextAll().slideToggle(300)
    
})



let secs = document.querySelector("section ul")
const xhr2 = new XMLHttpRequest()
xhr2.open("get","http://chst.vip:1234/api/getmoneyctrl")
xhr2.onload = function(){
    if(xhr1.status === 200){
        let res2 = JSON.parse(xhr2.responseText)
        console.log(res2.result)
        let lis =''
        let regExp = /^<[^<]+\s+src="([^''""]*)"/
        res2.result.forEach((item,index) => {
            let url = res2.result[index].productImgSm.match(regExp)[1].split('=')[2];
            lis +=
            `
            <li>
                <a productid=${item.productId} >
                    <div>
                        <img src="${url}" alt="">
                    </div>



                    <div class="ycsj">
                        <div>
                            <h4>${item.productName}</h4>
                        </div>

                        <div class="ycpl">
                            <span>${item.productFrom}${item.productTime}</span>
                            <i></i>
                            <span>${item.productComCount}</span>
                        </div>
                    </div>
                </a>
            </li>
            `
            
        })
        secs.innerHTML = lis


    }
}
xhr2.send(null)
$('section ul').on('click','li',function(){
    let productid = $(this).find('a').attr('productid')
    console.log(productid)
    location.href = `../第二阶段项目/pages/page2-1.html?productid=${productid}`
})